package com.sys.SysTanks.service.impl;

import java.util.List;

import com.sys.common.exception.ServiceException;
import com.sys.common.utils.DateUtils;
import com.sys.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import com.sys.SysTanks.mapper.SysTanksMapper;
import com.sys.SysTanks.domain.SysTanks;
import com.sys.SysTanks.service.ISysTanksService;

/**
 * 养殖桶Service业务层处理
 * 
 * @author sys
 * @date 2025-09-04
 */
@Service
public class SysTanksServiceImpl implements ISysTanksService 
{
    @Autowired
    private SysTanksMapper sysTanksMapper;

    /**
     * 查询养殖桶
     * 
     * @param id 养殖桶主键
     * @return 养殖桶
     */
    @Override
    public SysTanks selectSysTanksById(Long id)
    {
        return sysTanksMapper.selectSysTanksById(id);
    }

    /**
     * 查询养殖桶列表
     * 
     * @param sysTanks 养殖桶
     * @return 养殖桶
     */
    @Override
    public List<SysTanks> selectSysTanksList(SysTanks sysTanks)
    {
        return sysTanksMapper.selectSysTanksList(sysTanks);
    }

    /**
     * 新增养殖桶
     * 
     * @param sysTanks 养殖桶
     * @return 结果
     */
    @Override
    public int insertSysTanks(SysTanks sysTanks)
    {
        sysTanks.setCreateTime(DateUtils.getNowDate());
        sysTanks.setCreateBy(SecurityUtils.getUsername());
        sysTanks.setUpdateTime(DateUtils.getNowDate());
        sysTanks.setUpdateBy(SecurityUtils.getUsername());
        return sysTanksMapper.insertSysTanks(sysTanks);
    }

    /**
     * 修改养殖桶
     * 
     * @param sysTanks 养殖桶
     * @return 结果
     */
    @Override
    public int updateSysTanks(SysTanks sysTanks)
    {
        sysTanks.setUpdateTime(DateUtils.getNowDate());
        sysTanks.setUpdateBy(SecurityUtils.getUsername());
        return sysTanksMapper.updateSysTanks(sysTanks);
    }

    /**
     * 批量删除养殖桶
     * 
     * @param ids 需要删除的养殖桶主键
     * @return 结果
     */
    @Override
    public int deleteSysTanksByIds(Long[] ids)
    {
        return sysTanksMapper.deleteSysTanksByIds(ids);
    }

    /**
     * 删除养殖桶信息
     * 
     * @param id 养殖桶主键
     * @return 结果
     */
    @Override
    public int deleteSysTanksById(Long id)
    {
        return sysTanksMapper.deleteSysTanksById(id);
    }
}
